Skip to content

fix(atlas): keep identical split pieces from tripping the shard's UNIQUE hash - #10897

Merged
dezren39 merged 1 commit into
mainfrom
claude/atlas-split-dup-pieces
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
claude/atlas-split-dup-pieces

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Before: promoting a staged unit failed with UNIQUE constraint failed: chunks.content_hash whenever two pieces had the same text. That happens when a file repeats a block and the embed-time split (#10836) cuts it into identical pieces, or when two items in one unit stage the same file.

After: promotion keeps every piece. The first piece with a given text keeps the plain SHA-256 of its text; a repeat gets a hash derived from that hash, its item id and its chunk index, so each item's pieces still read back to its exact text.

How: a unique_piece_hash helper tracks hashes used in the shard. New test promotion_keeps_pieces_and_items_with_identical_text stages two identical files that each split into three identical pieces; it fails on main with the UNIQUE error and passes here. cargo test -p atlas-core passes in full.

Refs #10836


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…QUE hash

The aggregator's shard table has `content_hash TEXT UNIQUE`. A chunk that
repeats a block splits into identical pieces, and two items can stage the
same file, so promotion failed with "UNIQUE constraint failed". The first
piece with a given text keeps its plain hash; a repeat gets a hash derived
from the text hash, item id and chunk index. Every piece is still kept, so
each item's pieces still partition its text.

Refs #10836

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 17, 2026 01:37
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 01:37
@dezren39
dezren39 merged commit 26b9375 into main Nov 17, 2026
@dezren39
dezren39 deleted the claude/atlas-split-dup-pieces branch November 17, 2026 01:37
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants